<?php

    require('init.php');
    require('header.php');
    
    $commandes = Commande::getCommandes();

    echo    '<div id="gestion_commande" class= "container_12">';
    echo    '<table class="grid_12" cellspacing="0">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Client</th>
                        <th>Date de la commande</th>
                        <th>Statut</th>
                        <th>Date de modification</th>
                        <th>Gérer</th>
                    </tr>
                </thead>
                <tbody>';
    foreach($commandes as $commande) {
        echo        '<tr class="'.$commande->getStatut()->getCouleur().'">
                        <td>
                            '.$commande->getId().'
                        </td>
                        <td>
                            '.$commande->getAdresse()->getClient().'
                        </td>
                        <td>
                            '.$commande->getDateAjout('d/m/Y H:i:s').'
                        </td>
                        <td>
                            '.$commande->getStatut().'
                        </td>
                        <td>
                            '.$commande->getDateModif('d/m/Y H:i:s').'
                        </td>
                        <td>
                            <a href="details_commande.php?id='.$commande->getId().'">
                                Gérer
                            </a>
                        </td>
                    </tr>';
    }
    echo        '</tbody>
                </table>
               </div>';
?>
